/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JCorrelationAnalysisPanel.java
 *
 * Created on 2010-5-25, 14:10:28
 */

package cn.ekuma.epos.analysis.businesspartner;

import cn.ekuma.epos.datalogic.I_DataLogicCustomers;
import cn.ekuma.epos.datalogic.I_DataLogicERP;
import cn.ekuma.epos.datalogic.I_DataLogicSystem;
import cn.ekuma.epos.module.ERP_UI_Swing_Model;
import cn.ekuma.epos.qkorder.dialog.JOrderFilterQBFDialog;
import cn.ekuma.rabbit.spi.I_ModelPart;

import com.openbravo.bean.erp.OperationCustomerCategory;
import com.openbravo.bean.infobean.CustomerInfo;
import com.openbravo.bean.infobean.UserInfo;
import com.openbravo.beans.JCalendarDialog;
import com.openbravo.data.basic.BasicException;
import com.openbravo.data.gui.MessageInf;
import com.openbravo.data.loader.query.QBFCompareEnum;
import com.openbravo.data.user.EditorCreator;
import com.openbravo.format.Formats;

import com.openbravo.pos.base.*;
import com.openbravo.pos.forms.JPanelView;
import com.openbravo.pos.panels.JCustomerFinder;
import com.openbravo.pos.panels.QuickTimerFilter;
import com.openbravo.pos.panels.event.CustomerChangedListener;
import com.openbravo.pos.panels.event.TimeCycleChangedEvent;
import com.openbravo.pos.panels.event.TimeCycleChangedListener;
import com.openbravo.pos.panels.event.UserChangedListener;
import com.openbravo.pos.panels.navigator.JCustomerNavigator;
import com.openbravo.pos.panels.navigator.JOperationCustomerCategoryNavigator;
import com.openbravo.pos.panels.navigator.JUserNavigator;
import com.openbravo.pos.panels.navigator.event.OperationCustomerCategoryChangedListener;

import java.awt.BorderLayout;
import java.util.Date;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.BoxLayout;
import java.awt.CardLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Dimension;
import javax.swing.ImageIcon;
import javax.swing.JCheckBox;

/**
 * @author Administrator
 */
public class JCorrelationAnalysisPanel extends javax.swing.JPanel implements JPanelView, BeanFactoryApp, EditorCreator, TimeCycleChangedListener, I_ModelPart<ERP_UI_Swing_Model> {

    I_DataLogicERP dlSales;
    I_DataLogicCustomers dlCustomers;
    I_DataLogicSystem dlSystem;
    AnalysisModelManager manager;
    JCorrelationTableView table;
    JCorrelationGraphView graph;
    JLinkContainerPanel linkContainerPanel;
    AppView app;
    private QuickTimerFilter timerFilter;
    Object[] beforeFilterParas;
    private CardLayout cl;
    private JCustomerNavigator customerNavigator;
    private JUserNavigator userNavigator;
    private JOperationCustomerCategoryNavigator operationCustomerCategoryNavigator;


    /**
     * Creates new form JCorrelationAnalysisPanel
     */
    public JCorrelationAnalysisPanel() {
        initComponents();
    }

    public void init(I_AppView app1) throws BeanFactoryException {
        this.app = (AppView) app1;
        manager = new AnalysisModelManager(dlSales);
        table = new JCorrelationTableView(manager);
        jSplitPane1.setLeftComponent(table);
        //jTabbedPane1.add("table",table);
        //graph=new JCorrelationGraphView(manager);
        //jTabbedPane1.add("grahp",graph);
        //jTabbedPane1.add(AppLocal.getIntString("Label.Payment"),new JCustomerPaymentsView(manager));
        linkContainerPanel = new JLinkContainerPanel(manager, app, dlSales, dlSystem, dlCustomers);
        manager.addOrderChangedListener(linkContainerPanel);
        jOrderLinkPanel.add(linkContainerPanel, BorderLayout.CENTER);
        jNavigator.setVisible(false);
        if (app.isCustomerView()) {
            btnCustomer.setEnabled(false);
            jtxtCustomer.setEditable(false);
            jtxtCustomer.setText(app.getCustomerInfo().getName());
            jButton5.setEnabled(false);
            btnNewButton.setEnabled(false);
            btnNewButton_1.setEnabled(false);
            btnNewButton_2.setEnabled(false);
            btnNewButton_3.setEnabled(false);
        } else {
            customerNavigator = new JCustomerNavigator(dlSales);
            customerNavigator.addCustomerChangedListener(new CustomerChangedListener() {

                @Override
                public void valueSelectChanged(CustomerInfo obj) {
                    if (beforeFilterParas == null)
                        try {
                            beforeFilterParas = (Object[]) createValue();
                        } catch (BasicException e) {
                            new MessageInf(e).show(JCorrelationAnalysisPanel.this);
                            return;
                        }
                    //Customer
                    beforeFilterParas[12] = QBFCompareEnum.COMP_EQUALS;
                    beforeFilterParas[13] = obj.getName();
                    jtxtCustomer.setText(obj.getName());

                    //Operation Customer Category
                    beforeFilterParas[18] = QBFCompareEnum.COMP_NONE;
                    beforeFilterParas[19] = null;

                    reQuery();

                }

            });
            jNavigator.add(customerNavigator, "customer");
            userNavigator = new JUserNavigator(dlSales);
            userNavigator.addUserChangedListener(new UserChangedListener() {

                @Override
                public void valueSelectChanged(UserInfo obj) {
                    if (beforeFilterParas == null)
                        try {
                            beforeFilterParas = (Object[]) createValue();
                        } catch (BasicException e) {
                            new MessageInf(e).show(JCorrelationAnalysisPanel.this);
                            return;
                        }
                    //User
                    beforeFilterParas[10] = QBFCompareEnum.COMP_EQUALS;
                    beforeFilterParas[11] = obj.getId();
                    reQuery();


                }

            });
            jNavigator.add(userNavigator, "user");
            operationCustomerCategoryNavigator = new JOperationCustomerCategoryNavigator(dlSales);
            operationCustomerCategoryNavigator.addOperationCustomerCategoryChangedListener(new OperationCustomerCategoryChangedListener() {

                @Override
                public void valueSelectChanged(OperationCustomerCategory obj) {
                    if (beforeFilterParas == null)
                        try {
                            beforeFilterParas = (Object[]) createValue();
                        } catch (BasicException e) {
                            new MessageInf(e).show(JCorrelationAnalysisPanel.this);
                            return;
                        }

                    //Customer
                    beforeFilterParas[12] = QBFCompareEnum.COMP_NONE;
                    beforeFilterParas[13] = null;
                    jtxtCustomer.setText(null);

                    //Operation Customer Category
                    beforeFilterParas[18] = QBFCompareEnum.COMP_EQUALS;
                    beforeFilterParas[19] = obj.getID();

                    reQuery();

                }

            });
            jNavigator.add(operationCustomerCategoryNavigator, "operationCustomerCategory");
        }

        cl = (CardLayout) (jNavigator.getLayout());
    }

    /**
     * This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        jSplitPane1 = new javax.swing.JSplitPane();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jOrderLinkPanel = new javax.swing.JPanel();

        setLayout(new java.awt.BorderLayout());

        jSplitPane1.setDividerLocation(400);
        jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
        jSplitPane1.setOneTouchExpandable(true);


        jOrderLinkPanel.setLayout(new java.awt.BorderLayout());
        jSplitPane1.setRightComponent(jOrderLinkPanel);

        add(jSplitPane1, java.awt.BorderLayout.CENTER);

        panel = new JPanel();
        add(panel, BorderLayout.NORTH);
        panel.setLayout(new BorderLayout(0, 0));


        jToolBar1 = new javax.swing.JToolBar();
        panel.add(jToolBar1, BorderLayout.NORTH);
        timerFilter = new QuickTimerFilter();
        panel.add(timerFilter, BorderLayout.CENTER);
        timerFilter.addTimeCycleChangedListener(this);
        jtxtCustomer = new javax.swing.JTextField();
        btnCustomer = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jTxtStartDate = new javax.swing.JTextField();
        btnDateStart = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jTxtEndDate = new javax.swing.JTextField();
        btnDateEnd = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();

        jToolBar1.setRollover(true);

        jtxtCustomer.setPreferredSize(new java.awt.Dimension(100, 25));
        jToolBar1.add(jtxtCustomer);

        btnCustomer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/kuser.png"))); // NOI18N
        btnCustomer.setFocusPainted(false);
        btnCustomer.setFocusable(false);
        btnCustomer.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnCustomer.setMargin(null);
        btnCustomer.setPreferredSize(new java.awt.Dimension(55, 25));
        btnCustomer.setRequestFocusEnabled(false);
        btnCustomer.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnCustomer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCustomerActionPerformed(evt);
            }
        });
        jToolBar1.add(btnCustomer);

        jLabel3.setText(AppLocal.getIntString("Label.StartDate")); // NOI18N
        jToolBar1.add(jLabel3);

        jTxtStartDate.setMinimumSize(new java.awt.Dimension(6, 15));
        jTxtStartDate.setPreferredSize(new java.awt.Dimension(150, 22));
        jToolBar1.add(jTxtStartDate);

        btnDateStart.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/date.png"))); // NOI18N
        btnDateStart.setFocusable(false);
        btnDateStart.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnDateStart.setPreferredSize(new java.awt.Dimension(55, 25));
        btnDateStart.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnDateStart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDateStartActionPerformed(evt);
            }
        });
        jToolBar1.add(btnDateStart);

        jLabel4.setText(AppLocal.getIntString("Label.EndDate")); // NOI18N
        jToolBar1.add(jLabel4);

        jTxtEndDate.setPreferredSize(new java.awt.Dimension(150, 22));
        jToolBar1.add(jTxtEndDate);

        btnDateEnd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/date.png"))); // NOI18N
        btnDateEnd.setFocusable(false);
        btnDateEnd.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnDateEnd.setPreferredSize(new java.awt.Dimension(55, 25));
        btnDateEnd.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnDateEnd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDateEndActionPerformed(evt);
            }
        });
        jToolBar1.add(btnDateEnd);

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/1rightarrow.png"))); // NOI18N
        jButton1.setFocusable(false);
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton1.setPreferredSize(new java.awt.Dimension(55, 25));
        jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton1);

        jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/search.png"))); // NOI18N
        jButton5.setFocusable(false);
        jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton5.setPreferredSize(new java.awt.Dimension(55, 25));
        jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton5);

        btnNewButton_4 = new JButton("");
        btnNewButton_4.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                m_jResert1ActionPerformed(e);
            }
        });
        btnNewButton_4.setIcon(new ImageIcon(JCorrelationAnalysisPanel.class.getResource("/com/openbravo/images/reload.png")));
        jToolBar1.add(btnNewButton_4);

        jNavigatorToolBar = new JPanel();
        panel.add(jNavigatorToolBar, BorderLayout.EAST);
        jNavigatorToolBar.setLayout(new BoxLayout(jNavigatorToolBar, BoxLayout.LINE_AXIS));

        btnNewButton = new JButton(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/search.png")));
        btnNewButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                jNavigator.setVisible(!jNavigator.isVisible());
                cl.show(jNavigator, "baseNavigator");
            }
        });

        inCredit = new JCheckBox(AppLocal.getIntString("label.debt"));
        jNavigatorToolBar.add(inCredit);
        jNavigatorToolBar.add(btnNewButton);

        btnNewButton_1 = new JButton(AppLocal.getIntString("label.customer"));
        btnNewButton_1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                cl.show(jNavigator, "customer");
            }
        });
        jNavigatorToolBar.add(btnNewButton_1);

        btnNewButton_2 = new JButton(AppLocal.getIntString("Menu.Users"));
        btnNewButton_2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                cl.show(jNavigator, "user");
            }
        });
        jNavigatorToolBar.add(btnNewButton_2);

        btnNewButton_3 = new JButton(AppLocal.getIntString("label.operationCustomerCategory"));
        btnNewButton_3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                cl.show(jNavigator, "operationCustomerCategory");
            }
        });
        jNavigatorToolBar.add(btnNewButton_3);

        jNavigator = new JPanel();
        jNavigator.setPreferredSize(new Dimension(240, 10));
        add(jNavigator, BorderLayout.EAST);
        jNavigator.setLayout(new CardLayout(0, 0));

        baseNavigator = new JPanel();
        jNavigator.add(baseNavigator, "baseNavigator");

        btnNewButton_5 = new JButton("超账龄单据");
        baseNavigator.add(btnNewButton_5);
    }// </editor-fold>//GEN-END:initComponents

    protected void m_jResert1ActionPerformed(ActionEvent e) {
        beforeFilterParas = null;
        jTxtStartDate.setText(null);
        jTxtEndDate.setText(null);
        if (!app.isCustomerView()) {
            jtxtCustomer.setText(null);
        }
        timerFilter.resert();
    }

    private void btnCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCustomerActionPerformed
        JCustomerFinder finder = JCustomerFinder.getCustomerFinder(this, dlSales);
        finder.search(null);
        finder.setVisible(true);
        // try {
        jtxtCustomer.setText(finder.getSelectedCustomer() == null
                ? null
                : finder.getSelectedCustomer().getName());// dlSales.loadCustomer(finder.getSelectedCustomer().getId()).toString());
        // } catch (BasicException e) {
        // MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotfindcustomer"), e);
        // msg.show(this);
        //}
    }//GEN-LAST:event_btnCustomerActionPerformed

    private void btnDateStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDateStartActionPerformed
        Date date;
        try {
            date = (Date) Formats.TIMESTAMP.parseValue(jTxtStartDate.getText());
        } catch (BasicException e) {
            date = null;
        }
        date = JCalendarDialog.showCalendarTimeHours(this, date);
        if (date != null) {
            jTxtStartDate.setText(Formats.TIMESTAMP.formatValue(date));
        }
    }//GEN-LAST:event_btnDateStartActionPerformed

    private void btnDateEndActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDateEndActionPerformed
        Date date;
        try {
            date = (Date) Formats.TIMESTAMP.parseValue(jTxtEndDate.getText());
        } catch (BasicException e) {
            date = null;
        }
        date = JCalendarDialog.showCalendarTimeHours(this, date);
        if (date != null) {
            jTxtEndDate.setText(Formats.TIMESTAMP.formatValue(date));
        }
    }//GEN-LAST:event_btnDateEndActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        try {
            beforeFilterParas = (Object[]) createValue();
            reQuery();
        } catch (BasicException ex) {
            new MessageInf(ex).show(this);
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed

        JOrderFilterQBFDialog orderTypeFiler = JOrderFilterQBFDialog.getOrderFilterQBFDialog(this, app, dlSales, dlCustomers);
        orderTypeFiler.setVisible(true);
        if (orderTypeFiler.isOK()) {
            try {
                beforeFilterParas = new Object[22];
                Object[] temp = (Object[]) orderTypeFiler.createValue();
                for (int i = 0; i < 18; i++)
                    beforeFilterParas[i] = temp[i];

                //Operation Customer Category
                beforeFilterParas[18] = QBFCompareEnum.COMP_NONE;
                beforeFilterParas[19] = null;
                //debt
                beforeFilterParas[20] = QBFCompareEnum.COMP_NONE;
                beforeFilterParas[21] = null;

                reQuery();
            } catch (BasicException ex) {
                new MessageInf(ex).show(this);
            }

        }
    }//GEN-LAST:event_jButton5ActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCustomer;
    private javax.swing.JButton btnDateEnd;
    private javax.swing.JButton btnDateStart;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton5;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jOrderLinkPanel;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JTextField jTxtEndDate;
    private javax.swing.JTextField jTxtStartDate;
    private javax.swing.JTextField jtxtCustomer;
    private JPanel panel;
    private JPanel jNavigator;
    private JPanel jNavigatorToolBar;
    private JButton btnNewButton;
    private JButton btnNewButton_1;
    private JButton btnNewButton_2;
    private JButton btnNewButton_3;
    private JButton btnNewButton_4;
    private JPanel baseNavigator;
    private JButton btnNewButton_5;
    private JCheckBox inCredit;
    // End of variables declaration//GEN-END:variables

    public String getTitle() {
        return "";
    }

    public void activate() throws BasicException {
        if (!app.isCustomerView()) {
            customerNavigator.loadData();
            userNavigator.loadData();
            operationCustomerCategoryNavigator.loadData();
        }
    }

    public boolean deactivate() {
        return true;
    }

    public JComponent getComponent() {
        return this;
    }

    public Object getBean() {
        return this;
    }

    @Override
    public Object createValue() throws BasicException {
        Object[] afilter = new Object[22];
        // Order ID
        afilter[0] = QBFCompareEnum.COMP_NONE;
        afilter[1] = null;

        //Order DefineType
        afilter[2] = QBFCompareEnum.COMP_NONE;
        afilter[3] = null;


        // Sale and refund checkbox
        afilter[4] = QBFCompareEnum.COMP_NONE;
        afilter[5] = 2;

        // Date range
        Object startdate = Formats.TIMESTAMP.parseValue(jTxtStartDate.getText());
        Object enddate = Formats.TIMESTAMP.parseValue(jTxtEndDate.getText());

        afilter[6] = (startdate == null) ? QBFCompareEnum.COMP_NONE : QBFCompareEnum.COMP_GREATEROREQUALS;
        afilter[7] = startdate;
        afilter[8] = (enddate == null) ? QBFCompareEnum.COMP_NONE : QBFCompareEnum.COMP_LESS;
        afilter[9] = enddate;

        //User
        afilter[10] = QBFCompareEnum.COMP_NONE;
        afilter[11] = null;


        //Customer
        if (jtxtCustomer.getText() == null || jtxtCustomer.getText().equals("")) {
            afilter[12] = QBFCompareEnum.COMP_NONE;
            afilter[13] = null;
        } else {
            afilter[12] = QBFCompareEnum.COMP_RE;
            afilter[13] = "%" + jtxtCustomer.getText() + "%";
        }

        //Location
        afilter[14] = QBFCompareEnum.COMP_NONE;
        afilter[15] = null;


        // Receipt money
        afilter[16] = QBFCompareEnum.COMP_NONE;
        afilter[17] = null;

        //Operation Customer Category
        afilter[18] = QBFCompareEnum.COMP_NONE;
        afilter[19] = null;

        //debt
        if (inCredit.isSelected()) {
            afilter[20] = QBFCompareEnum.COMP_DISTINCT;
            afilter[21] = new Double(0.0);
        } else {
            afilter[20] = QBFCompareEnum.COMP_NONE;
            afilter[21] = null;
        }

        return afilter;

    }

    private void reQuery() {
        try {
            manager.query(beforeFilterParas);
            //graph.setGraph(manager.getGraph());
            table.expandALL();
            if (beforeFilterParas[7] != null)
                jTxtStartDate.setText(Formats.TIMESTAMP.formatValue(beforeFilterParas[7]));
            else
                jTxtStartDate.setText(null);
            if (beforeFilterParas[9] != null)
                jTxtEndDate.setText(Formats.TIMESTAMP.formatValue(beforeFilterParas[9]));
            else
                jTxtEndDate.setText(null);
        } catch (BasicException ex) {
            new MessageInf(ex).show(this);
        }
    }

    @Override
    public void timeCycleChanged(TimeCycleChangedEvent e) {
        if (beforeFilterParas == null)
            try {
                beforeFilterParas = (Object[]) createValue();
            } catch (BasicException ex) {
                new MessageInf(ex).show(this);
                return;
            }
        // Date range
        Object startdate = e.getStartDate();
        Object enddate = e.getEndDate();

        beforeFilterParas[6] = (startdate == null) ? QBFCompareEnum.COMP_NONE : QBFCompareEnum.COMP_GREATEROREQUALS;
        beforeFilterParas[7] = startdate;
        beforeFilterParas[8] = (enddate == null) ? QBFCompareEnum.COMP_NONE : QBFCompareEnum.COMP_LESS;
        beforeFilterParas[9] = enddate;
        reQuery();
    }

    @Override
    public String getModelName() {
        return ERP_UI_Swing_Model.MODEL_NAME;
    }

    @Override
    public void setModel(ERP_UI_Swing_Model mode) {
        dlSales = mode.getDLERP();
        dlCustomers = mode.getDLCustomer();
        dlSystem = mode.getDLSystem();
    }

}
